#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<string.h>
#include<fcntl.h>
#include<sys/stat.h>
#include<iconv.h>
#include<strings.h>
#include<errno.h>
#include<chardet.h>

#define CHARSET_MAX 1024

class CCharSetConvert
{
public:
	CCharSetConvert();

	~CCharSetConvert();

	char * GetCharset(const char *inBuf, const unsigned int inLen, int & iOutRet);

	int CharsetConvert(const char *in_buf, const int inLen, char* out_buf, int out_max_len, const char *to_charset="UTF-8" );

protected:
	void Init();

	bool IsConsOk();

private:
	void * m_oBuf;

	chardet_t m_pDetHandle; //charset parse handle, type:ptr

	bool m_ConsOk; // descripe construct status

	char m_charset[CHARSET_MAX];
};


